import {
  getBalance
} from "../../api/user/user"
import { moneyFormat } from "../../utils/common"

Page({

  /**
   * 页面的初始数据
   */
  data: {
    money: ""
  },

  onLoad() {
    this.getAmountBalance();
  },

  goPayCode() {
    wx.navigateTo({
      url: '/pages/pay-code/pay-code',
    })
  },

  // 获取账户余额
  getAmountBalance() {
    getBalance().then(res => {
      this.setData({
        money: moneyFormat(res.data)
      })
    }).catch(err => {
      console.error(err);
    })
  },
})